<?php
/******************************************************
v4 - Management Framework
Copyright (C) 2008  Gary Taylor, gMerc Incorporation
http://www.gmerc.com/v4/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

gary@gmerc.com
******************************************************/
class login {
  function loaddata() {
    global $masterclass;

    $masterclass->websiteconfig['title'].=' - Login';

  return;
  }

  function display() {
  global $masterclass;

?>
<script language="javascript">
function try_login(login_name,login_pass,posttoken) {
  sajax_request_type = 'POST';
  x_ajax_login(login_name,login_pass,posttoken,try_login_cb);
  sajax_request_type = '';
}
function try_login_cb(val) {
  window.location.reload();
}
</script>
<table width="100%" height="100%" border="0" style="width:100%;height:100%;"><tr valign="middle"><td align="center" style="text-align:center;width:100%;height:100%;"><center>
<?php
/* Start Window */
    echo $masterclass->allclasses['websites']->sitebox_start('225');
    echo $masterclass->allclasses['websites']->sitebox_headline('Login','');

    /* create new random postid */
    $_SESSION['login_authid']=time().uniqid(rand(65,90).time());
    
    $loginonclick=' try_login(document.getElementById(\'login_username\').value,document.getElementById(\'login_password\').value,\''.$_SESSION['login_authid'].'\'); ';
    echo $masterclass->allclasses['websites']->add_login($loginonclick);

    echo $masterclass->allclasses['websites']->sitebox_end();
/* End Window */
?>
</td></tr></table>
<?php

  return;
  }
}
?>